#coding=utf-8
__author__ = 'Meteor'

import logging
from logging import FileHandler,StreamHandler
import seting,os

class Logger():
    def __init__(self):
        self.__loger = logging.getLogger('main')
        self.__loger.setLevel(seting.LOG_LEVER)
        # 设置日志格式
        self.__fmt = logging.Formatter('%(asctime)s   %(module)s   %(funcName)s   %(levelname)s：  %(message)s')


        logFile = os.path.join(seting.BASEPATH,'logs','auto.log')
        self.__hander = FileHandler(logFile,encoding='utf-8')
        self.__hander.setFormatter(self.__fmt)


        self.__stramHander = StreamHandler()
        self.__stramHander.setFormatter(self.__fmt)

        self.__loger.addHandler(self.__hander)
        self.__loger.addHandler(self.__stramHander)

    def get_log(self):
        return self.__loger

logger = Logger().get_log()


